package cn.csdj.sism.web;


import cn.csdj.sism.pojo.Adultexam;
import cn.csdj.sism.service.AdultexamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 成人考试控制器
 * 夏康
 */
@CrossOrigin
@RestController
@RequestMapping("/adultexam")
public class AdultexamController {

    //注入成人考试业务层
    @Autowired
    AdultexamService adultexamService;

    //添加成人考试
    @PostMapping
    public void insert(@RequestBody Adultexam adultexam){
        adultexamService.insert(adultexam);
    }

    //根据id删除成人考试
    @DeleteMapping("/{id}")
    public void deleteById(@PathVariable Integer id){
        adultexamService.deleteById(id);
    }
    //修改成人考试
    @PutMapping
    public void update(@RequestBody Adultexam adultexam){
        adultexamService.update(adultexam);
    }
    //根据id查询成人考试
    @GetMapping("/{id}")
    public Adultexam selectById(@PathVariable Integer id){
        return adultexamService.selectById(id);
    }
    //查询所有成人考试
    @GetMapping
    public List<Adultexam> selectAll(){
        return adultexamService.selectAll();
    }
}
